﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

/// <summary>
/// Summary description for CommentDAL
/// </summary>
public class CommentDAL
{
    DatabaseAccess dba = new DatabaseAccess();
    public bool AddComment(Comment objComment)
    {
        SqlParameter[] paramList = new SqlParameter[5];
        paramList[0] = new SqlParameter("@pd_id",SqlDbType.Int);
        paramList[0].Value = objComment.PdID;
        paramList[1] = new SqlParameter("@cus_id", SqlDbType.Int);
        paramList[1].Value = objComment.CusID;
        paramList[2] = new SqlParameter("@cm_title",SqlDbType.NVarChar,100);
        paramList[2].Value = objComment.CmTitle;
        paramList[3] = new SqlParameter("@cm_content",SqlDbType.NVarChar,300);
        paramList[3].Value = objComment.CmContent;
        paramList[4] = new SqlParameter("@cm_status",SqlDbType.Bit);
        paramList[4].Value = objComment.CmStatus;
        return dba.executeUpdate("proc_InsertComment", paramList);
    }
    public DataTable GetCommentByPDID(int pdID)
    {
        SqlParameter[] paramList = new SqlParameter[1];
        paramList[0] = new SqlParameter("@pd_id",SqlDbType.Int);
        paramList[0].Value = pdID;
        return dba.executeSelect("proc_GetCommentByPDID",paramList);
    }
	public CommentDAL()
	{
		//
		// TODO: Add constructor logic here
		//
	}
}
